package cn.com.guage.monitor.log.hikair.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;

import cn.com.guage.monitor.log.hikair.domain.User;
import cn.com.guage.monitor.log.hikair.service.UserService;

@RestController
public class UserController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private UserService userService;
    
    @RequestMapping("add")
    public Object addUser() {
    	logger.info("开始执行新增用户");
        User user = new User();
        user.setId(new Long(1));
        user.setName("张三丰");
        userService.addUser(user);
    	logger.info("新增用户执行结束!");
        return "ok";
    }
    
    @RequestMapping("list")
    public  List<User> selectUserListByUser() {
    	logger.info("开始查询用户信息");
        User user = new User();
        user.setId(new Long(1));
        user.setName("张三丰");
        List<User> list =  userService.selectUserListByUser(user);
    	logger.info("用户信息查询结果为："+JSON.toJSONString(list));
        return list;
    }
    
}
